<%@ page pageEncoding="UTF-8" contentType="text/html; charset=utf-8"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Reading List</title>
<% 
	String message = (String)session.getAttribute("message");
	if (message != null){
		session.removeAttribute("message");
	}
	else {
		message  = "";
	}

	String language = request.getParameter("language");
	if (language == null){
			response.sendRedirect("setLanguage.jsp");
	}
	String targetLanguage = request.getParameter("target");
	if (targetLanguage == null){
			response.sendRedirect("setTargetLanguage.jsp?language=" + language);
	}
	
	java.util.List<org.languageguide.readings.TranslatedReading> readings = org.	languageguide.readings.ReadingManager.getReadings(language, targetLanguage, true);
	
	/*java.util.List<org.languageguide.readings.TranslatedReading> userReadings = org.languageguide.readings.ReadingManager.getReadings(language, targetLanguage, false);*/
	
	java.util.List<org.languageguide.readings.Reading> videos = org.languageguide.readings.ReadingManager.getTranslatedVideos(language, targetLanguage);
	
	String targetLanguageName = "other"; //languageguide.LanguageList.getLanguageName(targetLanguage);
%>
<style type="text/css">
body {
	text-align:center;
}
hr {
	width: 700px;
	margin-top: 40px;
}
li {padding: 8px;
}
.comments { border: #CCFFCC  1px DOTTED;
background-color:#EEFFEE; 
padding: 14px;
margin-top: 8px;
}
.go-to{
	
padding: 20px;
margin-top: 0px;
margin-right: 10px;
}
#suggest-btn {

background: #7FB3CC;
margin-left: 4px;
padding: 10px 8px 12px;

font-weight: bold;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
border-top-left-radius: 4px 4px;
border-top-right-radius: 4px 4px;
border-bottom-right-radius: 4px 4px;
border-bottom-left-radius: 4px 4px;
}
#suggest-btn a{
	color: white;
}
.comments2 { border: #BBBBFF  1px solid;background:-webkit-gradient(linear, left top, left bottom, from(#DDDDFF), to(#EEEEFF));background-color:#DDDDFF; padding: 14px;margin-top: 8px;border-radius:4px;display:inline-block;}
.comments3 { border: #FFBBBB  1px solid;background:-webkit-gradient(linear, left top, left bottom, from(#FFDDDD), to(#FFEEEE));background-color:#FFDDDD; padding: 14px;margin-top: 8px;border-radius:4px;display:inline-block;}
.comments4 { border: #BBFFBB  1px solid;background:-webkit-gradient(linear, left top, left bottom, from(#DDFFDD), to(#EEFFEE));background-color:#DDFFDD; padding: 14px;margin-top: 8px;border-radius:4px;display:inline-block;}
</style>
</head>
<body>
<div style="position: absolute; top: 6px; left: -3px; margin-top: 3px; margin-left: 3px;"> <strong> Interactive Reading Wiki (Translate From English to <%= targetLanguageName %></strong>)</div>
<p>
  <jsp:include page="../user/user.jsp"/>
  <% if (!targetLanguage.equals("en")){ %>
</p>
<h2 style="margin-top:30px;">Readings Wiki </h2>
<div style=" width: 300px; margin:auto;"></div>
<% } %>
<% if (message != null){ %>
<p><strong><%= message %></strong></p>
<% } %>
<div class="comments4" style="width: 580px; margin:auto; margin-top: 20px; margin-bottom: 20px; text-align:left;">
  This page is for translating <a href="/eng/about.html#readings">interactive readings</a>. Once all the sentences have been translated, the reading is generated and published.</div>
  <h2 style="text-align:left; width:580px; margin: 10px auto;">
Readings</h2>
<table width="500" border="0"  style="margin: auto; text-align:left; ">
<%
//	System.out.println(readings.size());

if (readings != null){
	for (org.languageguide.readings.TranslatedReading reading: readings){
		if (!reading.isPublished()){
			out.println("<tr><td>" + reading.getTitle() + "</td></tr><tr><td>&nbsp;&nbsp;•&nbsp;<a href=\"translate_reading.jsp?id=" + reading.getId() + "&target=" + targetLanguage + "\">Translate Sentences</a> •&nbsp;<a href=\"translate_reading_def.jsp?id=" + reading.getId() + "&target=" + targetLanguage + "\">Translate Definitions</a></td></tr>");
		}
	}
}
%>
</table>
<h2 style="text-align:left; width:580px; margin:auto; margin-top: 30px;">
<strong>Videos</strong></h2>
<% if (videos != null && videos.size() > 0){ %>
<% } %>	
<table width="500" border="0" style="margin: auto; margin-top: 20px; text-align:left;">
<%
//	System.out.println(readings.size());

if (videos != null){
	for (org.languageguide.readings.Reading reading: videos){
		String id = reading.getId();
		out.println("<tr><td>" + reading.getTitle() + "</td></tr><tr><td>&nbsp;&nbsp;•&nbsp;<a href=\"translate_reading.jsp?id=" + id + "&target=" + targetLanguage + "\">Translate Sentences</a> •&nbsp;<a href=\"translate_reading_def.jsp?id=" + id + "&target=" + targetLanguage + "\">Translate Definitions</a></td></tr>");
	}
}
%>
</table>
<p style="margin: 0px; clear: both;">&nbsp;</p>

</body>
</html>